﻿using System.Collections.Generic;
using System.Linq;
using NanoERP.Model.Poco;

namespace NanoERP.Model.SystemMgmt
{
    public class UserModel : SYS_User
    {
        private IList<RoleModel> _roles;
        public IList<RoleModel> Roles
        {
            get
            {
                if (_roles == null)
                    _roles = new List<RoleModel>();
                return _roles;
            }
        }

        public IEnumerable<RoleModel> RealRoles
        {
            get
            {
                return Roles.Where(d => d.Checked == false);
            }
        }

        public bool IsNewUser
        {
            get { return string.IsNullOrEmpty(this.LoginName); }
        }
    }

}
